--
-- @Author:      feilong
-- @DateTime:    2019-08-19 14:02:03
-- @Description: 用户对象处理

local table_insert = table.insert
local table_remove = table.remove
local math_floor = math.floor

local UserInfo = class("UserInfo")


--构造函数
function UserInfo:ctor(base_data, enter_data)

    --角色数据
    self.uid = base_data.uid
    self.coins = base_data.coins --身上金币
    self.vip_level = base_data.vip_level or 0    --vip等级
    self.first_charge_status = base_data.first_charge_status --首充状态
    self.person_water = base_data.person_water --个人流水
    self.person_water2 = base_data.person_water2

    self.name = enter_data.name
    self.icon = enter_data.icon
    self.sex = enter_data.sex
    self.icon_border = enter_data.icon_border  --头像框
    self.client_version = enter_data.client_version
    self.channel = enter_data.channel
    self.cur_channel = enter_data.cur_channel
    self.device_id = enter_data.device_id
    self.device_brand = enter_data.device_brand

    --活动中数据-------------------------------------------------------------------------------
    self.redpack_all_coins = 0 --红包中领取的金币
    self.redpack_num = 0 --已领取的红包数
    self.redpack_max_num = 0 --可领取的红包数
    self.redpack_coins = 0 --当领取金额

end



function UserInfo:getId()
    return self.uid
end

--取user id
function UserInfo:getUid()
    return self.uid
end

--比较是否一样
function UserInfo:compare(user)
    if not user then
        return false
    end
    if self.uid == user:getUid() then 
        return true
    end
    return false
end

--取vip
function UserInfo:getVipLevel()
    return self.vip_level
end

function UserInfo:getCoins()
    return self.coins
end
function UserInfo:setCoins(coins)
    self.coins = coins
end
function UserInfo:addCoins(coins)
    self.coins = self.coins + coins
end

function UserInfo:getRedpackAllCoins()
    return self.redpack_all_coins
end
function UserInfo:setRedpackAllCoins(coins)
    self.redpack_all_coins = coins
end

function UserInfo:getRedpackCoins()
    return self.redpack_coins
end
function UserInfo:setRedpackCoins(coins)
    self.redpack_coins = coins
end

--已领取的红包数
function UserInfo:getRedpackNum()
    return self.redpack_num
end
function UserInfo:setRedpackNum(num)
    self.redpack_num = num or 0
end

function UserInfo:getMaxRedpackNum()
    return self.redpack_max_num
end
function UserInfo:setMaxRedpackNum(num)
    self.redpack_max_num = num or 0
end

function UserInfo:getClientVersion()
    return self.client_version
end

function UserInfo:getChannel()
    return self.channel
end

function UserInfo:getDeviceId()
    return self.device_id
end


--首充状态 0未达到条件， 1达到条件， 2已领取奖励
function UserInfo:getChargeStatuse()
    return self.first_charge_status or 0
end
function UserInfo:setChargeStatuse(status)
    self.first_charge_status = status
end

--个人流水
function UserInfo:getPersonWater()
    return self.person_water or 0
end
function UserInfo:setPersonWater(person_water)
    self.person_water = person_water
end

--首充后个人流水
function UserInfo:getPersonWater2()
    return self.person_water2 or 0
end
function UserInfo:setPersonWater2(person_water)
    self.person_water2 = person_water
end








return UserInfo